#include "graph.h"

int main()
{
    Graph<int, int> g1 = readGraphFromIOstream<int, int>();
    vector<vector<int>> SCCvect;
    SCCsearch<int, int>(g1, SCCvect);
    for (auto it = SCCvect.begin(); it != SCCvect.end(); it++)
    {
        for (auto it2 = it->begin(); it2 != it->end(); it2++)
            std::cout << *it2 << " ";
        std::cout << "\n";
    }
    cout << "\n\n";
    map<int, int> dist;
    if (!fordBellman<int, int>(g1, 1, dist)) { //алгорим Форда Беллмана и вывод результата
        cout << "Found cycle of negative length\n";
    }
    for(auto it = dist.begin(); it != dist.end(); it++)
    {
        if (it->second != numeric_limits<int>::max())
            cout << "to " << it->first << ": " << it->second << "\n";
        else
            cout << "to " << it->first << ": unreachable" << "\n";
    }
}